package com.jbookshelf.dal.entities;

// Generated 23.11.2012 22:05:17 by Hibernate Tools 3.6.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * Books generated by hbm2java
 */
@Entity
@Table(name = "BOOKS", schema = "PUBLIC", catalog = "PUBLIC", uniqueConstraints = @UniqueConstraint(columnNames = "ISBN"))
public class Books implements java.io.Serializable {

	private Integer id;
	private Authors authors;
	private Publishers publishers;
	private Languages languages;
	private String name;
	private String summary;
	private Date publishedOn;
	private String edition;
	private int pagesCount;
	private String isbn;
	private Set<BooksGenres> booksGenreses = new HashSet<BooksGenres>(0);

	public Books() {
	}

	public Books(Authors authors, Publishers publishers, Languages languages,
			String name, String summary, Date publishedOn, int pagesCount,
			String isbn) {
		this.authors = authors;
		this.publishers = publishers;
		this.languages = languages;
		this.name = name;
		this.summary = summary;
		this.publishedOn = publishedOn;
		this.pagesCount = pagesCount;
		this.isbn = isbn;
	}

	public Books(Authors authors, Publishers publishers, Languages languages,
			String name, String summary, Date publishedOn, String edition,
			int pagesCount, String isbn, Set<BooksGenres> booksGenreses) {
		this.authors = authors;
		this.publishers = publishers;
		this.languages = languages;
		this.name = name;
		this.summary = summary;
		this.publishedOn = publishedOn;
		this.edition = edition;
		this.pagesCount = pagesCount;
		this.isbn = isbn;
		this.booksGenreses = booksGenreses;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AUTHOR_ID", nullable = false)
	public Authors getAuthors() {
		return this.authors;
	}

	public void setAuthors(Authors authors) {
		this.authors = authors;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PUBLISHER_ID", nullable = false)
	public Publishers getPublishers() {
		return this.publishers;
	}

	public void setPublishers(Publishers publishers) {
		this.publishers = publishers;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "LANG_ID", nullable = false)
	public Languages getLanguages() {
		return this.languages;
	}

	public void setLanguages(Languages languages) {
		this.languages = languages;
	}

	@Column(name = "NAME", nullable = false, length = 256)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SUMMARY", nullable = false, length = 1024)
	public String getSummary() {
		return this.summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "PUBLISHED_ON", nullable = false, length = 10)
	public Date getPublishedOn() {
		return this.publishedOn;
	}

	public void setPublishedOn(Date publishedOn) {
		this.publishedOn = publishedOn;
	}

	@Column(name = "EDITION", length = 32)
	public String getEdition() {
		return this.edition;
	}

	public void setEdition(String edition) {
		this.edition = edition;
	}

	@Column(name = "PAGES_COUNT", nullable = false)
	public int getPagesCount() {
		return this.pagesCount;
	}

	public void setPagesCount(int pagesCount) {
		this.pagesCount = pagesCount;
	}

	@Column(name = "ISBN", unique = true, nullable = false, length = 32)
	public String getIsbn() {
		return this.isbn;
	}

	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "books")
	public Set<BooksGenres> getBooksGenreses() {
		return this.booksGenreses;
	}

	public void setBooksGenreses(Set<BooksGenres> booksGenreses) {
		this.booksGenreses = booksGenreses;
	}

}
